//引入vue和vue-router
import Vue from 'vue'
import VueRouter from 'vue-router'
//安装vue-router
Vue.use(VueRouter)
//路由懒加载
const Home = () => import('@/views/Home.vue')
const User = () => import('@/views/user/Index.vue')
const Classification = () => import('@/views/Classification.vue')
const Cart = () => import('@/views/Cart.vue')
const Test = () => import('@/views/Cart.vue')

//创建路由相关配置
const routes = [{
		path: '/',
		name: 'Home',
		component: Home
	},
	{
		path: '/user',
		name: 'User',
		component: User
	},
	{
		path: '/home',
		name: 'Home',
		component: Home
	},
	{
		path: '/classification',
		name: 'Classification',
		component: Classification
	},
	{
		path: '/cart',
		name: 'Cart',
		component: Cart
	},
	{
		path: '/test',
		name: 'Test',
		component: Test
	}
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})
//导出router，并在main.js内注册
export default router
